1. Field of the Invention
The present invention relates to a numerical control apparatus having a function which is available for both closed area (pocket) machining and open area machining, and more particularly to a numerical control apparatus capable of producing an offset figure for a machining tool, which has both an approach path to the offset figure and a retract path therefrom.
2. Description of the Prior Art
A conventional numerical control (NC) apparatus will now be described with reference to FIGS. 1(a) to 8(b).
FIG. 1(a) is a schematic diagram illustrating a workpiece before being machined and FIG. 1(b) is a schematic diagram illustrating a workpiece after being machined. FIG. 2(a) is a block diagram showing a hardware of the conventional NC apparatus; FIG. 2(b) is a diagram for showing an input data display on the CRT display shown in FIG. 2(a); and FIG. 2(c) is a diagram showing an input configuration obtained from the input data in FIG. 2(b). FIGS. 3(a) and 3(b) are diagrams showing data structure in a RAM section of a memory 2 of FIG. 2(a). FIGS. 4 and 5 are flowcharts of an operation of the conventional apparatus. FIGS. 6(a)-(c) are diagrams illustrating an approach path. FIG. 7 is a diagram showing an example of production of an approach path for directing a machine tool to the workpiece. FIG. 8(a) illustrates a workpiece to be machined, and FIG. 8(b) is a diagram illustrating possible approach paths to the workpiece of FIG. 8(a) with regard to problems accompanying the conventional apparatus.
In FIG. 2(a). reference numeral 1 designates a CPU, and the memory 2 includes a RAM and a ROM which store a control program for controlling the CPU 1 such as a machining program and the like. A keyboard 3 is used to input, into the memory 2, coordinates of a final machined version of a workpiece, data for machining and the like. A CRT 4 displays machining programs and picture images as shown in FIG. 2(b). A servo controller 5 converts displacement data from the CPU into the number of pulses for actually driving a servo motor 6 included in a machine tool 7.
Operation of the conventional apparatus will now be described as follows. The display 8 shown in FIG. 2(b) is first selected and displayed on the CRT display 4. The final machined version 9 of a workpiece as shown in FIG. 2(c) is input in the form of coordinates together with machining conditions, such as data concerning the tools to be used.
When a tool path provision key is pressed after all the data is input, the CPU 1 calculates the center of an arc, the radius of the art and the length of lines and stores this information in accordance with the data structure as shown in FIG. 3(a) in the RAM of the memory 2.
In FIG. 3(a), an indicator is data of about two bytes representing the category of a block or section of final machined version, for example in the form of data structure shown in FIG. 3(b). The variables x and y represent, respectively, coordinates of ends of the blocks or sections, such as a line and an arc, each variable being of 4 or 8 byte data depending on the system. When the block or section is an arc, the variables i and j indicate the x and y coordinates of the center of the arc, and k indicates a radius thereof. There the block or section is a straight line, the variables i, j, and k are assigned either no meaning or an equation representing a straight line.
In the case where a workpiece 10, as shown in FIG. 1(a), is to machined to have a final machined version as shown in FIG. 1(b), input data for points P1 to P7 are stored in the memory 2 in accordance with the data structure shown in FIG. 3(a).
Then, an offset locus 11, which represents a locus of the center of the machining tool is produced as shown in FIG. 10(a). An offset figure (locus) 11 is formed, as shown in FIG. 7, by connecting points Q1 to Q7 which are points offset inwardly by an offset value equal to the radius of the tool used. The offset figure is a border line beyond which the center of machining is prevented from going. An approach path 12 is produced with respect to this offset FIG. 11 according to an operation flow shown in FIGS. 4 and 5.
In FIG. 4, points where vertical walls of the workpiece meet at an acute angle to form convex surface, such that an angle of a portion to be machined exceeds 180.degree., are searched in the closed curve of the offset FIG. 11 (step 101). If such a point is found, then a determination is made whether or not it is possible to approach the point (step 102). If possible, an approach path for entering a point next to the point perpendicularly thereto is produced as shown in FIG. 6(a) (step 103). If approach to the point is impossible, the searching operation is carried out to find the next such point. The term "impossible to approach" indicates that the length of that block or section (e.g., Q1-Q2. Q2-Q3, ..., Q7-Q1, in FIG. 7) is shorter than the radius of the tool, for example. A point where the surface is convex is first searched because a load on a machining tool is lowest in such an approach. In the case where there is no such point or there are no points to where approach is possible, then a searching operation is started to find a point that is located on a smoothly curved portion of the closed curve of the offset FIG. 1 (step 104). If a point located on a smoothly curved portion thereof is found, then a determination is made whether or not it is possible to approach the point (step 105). If possible, an approach path 12 is produced as shown in FIG. 6(b) (step 106). It should be noted that the reason why the smooth portion within the closed curve is searched secondly is because the load on the machining tool in this instance is relatively lower than the other portions, yet greater than the load on the machining tool for a point in a convex surface.
lf the approach path 12 cannot be produced through the aforementioned steps, it means that either there are only concave portions, and/or there are only pints to which the approach paths cannot be produced. Then a determination is made whether or not there is a point between two concave portions (step 107). If there is a point therebetween, it is decided whether or not it is possible to approach that point (step 108). If possible then an approach path is produced as shown in FIG. 6(c) (step 109).
In the case where no approach paths can be produced through the aforementioned steps, a determination is made whether there is an error in the approach. This error means that the size of a workpiece to be machined is too small to develop an approach thereto.
In the case where a final workpiece shown in FIG. 1(b) is to be machined from a workpiece shown in FIG. 1(a), since the point P3 is a point where the surface of the workpiece is convex relative to adjacent sections, such an approach AP1.sup.. Q3 (a "" indicating a path connecting the two points) as shown in FIG. 7 is produced. Then, tool paths and other machining information are produced and machining information is output to the servo controller 5 for controlling the machine tool 7 to perform the machining of the workpiece.
With a conventional numerical control apparatus thus constructed, the approach path 12 is obtained without taking wall category of a final machined version into account, i.e., determining whether the vertical walls are real or imaginary, and therefore it is disadvantageous in that, in the case of machining a workpiece having a configuration as shown in FIG. 8, for example, due to the point AP being convex, there is a possibility that an approach path AP1.sup.. AP or AP2.sup.. AP may be produced, resulting in interference between the tool and the workpiece.